﻿CREATE FUNCTION [dbo].[hist_Tracker_Car__Last]
(	@VIN varchar(17)
)RETURNS TABLE
AS
RETURN 
SELECT     htc.TrackerID, htc.VIN, htc.TechnicianID, htc.DateStamp
FROM (SELECT MAX(Hist_BatchHID) AS Hist_BatchHID FROM vhist_t_Tracker_Car WHERE VIN = @VIN) AS BID
INNER JOIN vhist_t_Tracker_Car AS htc ON BID.Hist_BatchHID = htc.Hist_BatchHID


